<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellpadding="4" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="34">
              <div style="position: relative;text-align: center">
                <span>{{reportData.title}}</span>
                <!--                <span style="position: absolute;right: 0px;top:0px">2019年12月</span>-->
              </div>
            </th>
          </tr>
          <tr>
            <td colspan="3">线别：{{ reportData.lineType }}</td>
            <td colspan="8">设备名称：{{ reportData.equipmentName }}</td>
            <td colspan="7">文件编号：{{ reportData.documentNumber }}</td>
            <td colspan="8">日期：{{ reportData.datePurchase }}</td>
            <td colspan="8">{{reportData.accountingMethod}}</td>
          </tr>
          <tr v-if="reportData.dayCheckName.length > 0">
            <td :rowspan="reportData.dayCheckName.length + 2">日保养</td>
            <td>保养项目及日期</td>
            <td>衡量标准</td>
            <td v-for="i in 31">{{ i }}</td>
          </tr>
          <tr v-for="(item,index) in reportData.dayCheckName" v-if="reportData.dayCheckName.length > 0">
            <td>{{item}}</td>
            <td>{{reportData.dayDealMethords[index]}}</td>
            <td v-for="fileds in reportData.dayCheckList[index]">{{fileds.inspectionResults}}</td>
          </tr>
          <tr v-if="reportData.dayCheckName.length > 0">
            <td colspan="2">作业员</td>
            <td v-for="fileds in reportData.dayCheckList[0]">{{fileds.maintainer}}</td>
          </tr>
          <tr v-if="reportData.weekCheckName.length > 0">
            <td :rowspan="reportData.weekCheckName.length + 1">周保养</td>
            <td>保养项目及日期</td>
            <td>衡量标准</td>
            <td colspan="4">第一周</td>
            <td colspan="4">保养人</td>
            <td colspan="4">第二周</td>
            <td colspan="4">保养人</td>
            <td colspan="4">第三周</td>
            <td colspan="4">保养人</td>
            <td colspan="4">第四周</td>
            <td colspan="3">保养人</td>
          </tr>
          <tr v-for="(item,index) in reportData.weekCheckName" v-if="reportData.weekCheckName.length > 0">
            <td>{{item}}</td>
            <td>{{reportData.weekDealMethords[index]}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][0].inspectionResults}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][0].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][1].inspectionResults}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][1].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][2].inspectionResults}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][2].maintainer}}</td>
            <td colspan="4">{{reportData.weekCheckList[index][3].inspectionResults}}</td>
            <td colspan="3">{{reportData.weekCheckList[index][3].maintainer}}</td>
          </tr>
          <tr v-if="reportData.monthCheckName.length > 0">
            <td :rowspan="reportData.monthCheckName.length + 1">月保养</td>
            <td>保养项目</td>
            <td colspan="29">完成在对应栏中打"√"未完成打"X",如有异常请阐述</td>
            <td colspan="3">保养人</td>
          </tr>
          <tr v-if="reportData.monthCheckName.length > 0">
            <td>{{reportData.monthCheckName[0]}}</td>
            <td colspan="29">{{reportData.monthCheckList[0][0].inspectionResults}}</td>
            <td colspan="3" :rowspan="reportData.monthCheckName.length">{{reportData.monthCheckList[0][0].maintainer}}</td>
          </tr>
          <tr v-for="(item,index) in reportData.monthCheckName.slice(1)" v-if="reportData.monthCheckName.length > 0">
            <td>{{item}}</td>
            <td colspan="29">{{reportData.monthCheckList[index+1][0].inspectionResults}}</td>
          </tr>
          <tr>
            <td colspan="2">注意事项</td>
            <td colspan="32">
             {{reportData.beCareful}}
            </td>
          </tr>
        </table>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** 回流焊日常点检记录表 **/
  name: 'ReflowSolderingDailySpotInspection',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    },
    type:{
      type:String,
      default:''
    }
  },
  data(){
    return {
      dayCheckList:[
        {
          checkName:'检查总电源是否正常',
          measure:'1'
        },
        {
          checkName:'检查各指示灯是否正常',
          measure:'2'
        },
      ],
      weekCheckList:[
        {
          checkName:'X/Y轴滑动是否正常',
          val:'1'
        },
        {
          checkName:'机械部分有无异响',
          val:'2'
        },
        {
          checkName:'各电磁阀气缸是否正常工作',
          val:'3'
        }
      ],
      monthCheckList:[
        {
          checkName:'传送皮带清洁张力检查',
          val:'1'
        },
        {
          checkName:'X/Y/Z轴丝杆加油',
          val:'1'
        },
      ]
    }
  }
}
</script>

<style scoped>

</style>